package org.wekit.engine.pvm.runtime;

import org.wekit.engine.pvm.PvmException;
import org.wekit.engine.pvm.delegate.ActivityBehavior;
import org.wekit.engine.pvm.process.Activity;

/**
 * 节点执行流转动作
 * @author HuangWeili
 *
 */
public class AtomicOperationActivityExecute implements AtomicOperation {

	/**
	 * 在这里不触发路由动作
	 */
	@Override
	public void execute(InterpretableExecution execution) {
	   Activity activity=(Activity)execution.getActivity();
		
	   ActivityBehavior activityBehavior=activity.getActivityBehavior();
	   if(null==activityBehavior)
	   {
		   throw new PvmException("no hehaviro in"+activity.toString());
	   }
	   
	   try{
		  activityBehavior.execute(execution);
	   }catch (RuntimeException e) {
        throw e;
	   }catch(Exception e)
	   {
		   throw new PvmException("couldn't execute activity "+activity.getId());
	   }
	   
	}

	@Override
	public boolean isAsync(InterpretableExecution execution) {
		// TODO Auto-generated method stub
		return false;
	}

	
	
	
}
